class OrderVO {
  int? id;
  int? roomId;
  String? roomNum;
  DateTime? createDate;
  int? createDateYear;
  int? createDateMonth;
  double? rent;
  double? otherCharge;
  double? electricityCharge;
  double? electricityUnitPrice;
  int? electricityAmount;
  int? electricityAmountLastMonth;
  int? electricityAmountResult;
  double? waterCharge;
  double? waterUnitPrice;
  int? waterAmount;
  int? waterAmountLastMonth;
  int? waterAmountResult;
  String? eleImage;
  String? waterImage;
  int? state;
  int? checkState;

  //首页显示,上月用电量
  int electricityAmountLastMonthCalculated = 0;
  //首页显示,上月用水量
  int waterAmountLastMonthCalculated = 0;
  //首页显示
  String? contact;

  // OrderVO.lastMonthData(this.electricityAmountLastMonth, this.waterAmountLastMonth);
  OrderVO.lastMonthData(this.createDate,this.electricityAmount,this.electricityAmountLastMonth,this.electricityAmountResult, this.waterAmount,this.waterAmountLastMonth,this.waterAmountResult);


  OrderVO(
      this.id,
      this.roomId,
      this.roomNum,
      this.contact,
      this.createDate,
      this.createDateYear,
      this.createDateMonth,
      this.rent,
      this.otherCharge,
      this.electricityCharge,
      this.electricityUnitPrice,
      this.electricityAmount,
      this.electricityAmountLastMonth,
      this.electricityAmountResult,
      this.waterCharge,
      this.waterUnitPrice,
      this.waterAmount,
      this.waterAmountLastMonth,
      this.waterAmountResult,
      this.eleImage,
      this.waterImage,
      this.state,
      this.checkState);

  OrderVO.homepage(
      this.id,
      this.roomId,
      this.roomNum,
      this.contact,
      this.createDate,
      this.createDateYear,
      this.createDateMonth,
      this.rent,
      this.otherCharge,
      this.electricityCharge,
      this.electricityUnitPrice,
      this.electricityAmount,
      this.electricityAmountLastMonth,
      this.electricityAmountResult,
      this.waterCharge,
      this.waterUnitPrice,
      this.waterAmount,
      this.waterAmountLastMonth,
      this.waterAmountResult,
      this.eleImage,
      this.waterImage,
      this.state,
      this.checkState);

  /***
   * id不需要,新增时会自增,更新时只做参数
   */
  Map<String, dynamic> toMap() {
    return {
      // 'id': id,
      'roomId': roomId,
      'roomNum': roomNum,
      'contact': contact,
      'createDate': createDate?.millisecondsSinceEpoch,
      'createDateYear': createDateYear,
      'createDateMonth': createDateMonth,
      'rent': rent,
      'otherCharge': otherCharge,
      'electricityCharge': electricityCharge,
      'electricityUnitPrice': electricityUnitPrice,
      'electricityAmount': electricityAmount,
      'electricityAmountLastMonth': electricityAmountLastMonth,
      'electricityAmountResult': electricityAmountResult,
      'waterCharge': waterCharge,
      'waterUnitPrice': waterUnitPrice,
      'waterAmount': waterAmount,
      'waterAmountLastMonth': waterAmountLastMonth,
      'waterAmountResult':waterAmountResult,
      'eleImage': eleImage,
      'waterImage': waterImage,
      'state': state,
      'checkState':checkState,
    };
  }

  factory OrderVO.fromMap(Map<String, dynamic> map) {
    return OrderVO.homepage(
      map['id'],
      map['roomId'],
      map['roomNum'],
      map['contact'],
      map['createDate'] != null
          ? DateTime.fromMillisecondsSinceEpoch(map['createDate'])
          : null,
      map['createDateYear'],
      map['createDateMonth'],
      map['rent'],
      map['otherCharge'],
      map['electricityCharge'],
      map['electricityUnitPrice'],
      map['electricityAmount'],
      map['electricityAmountLastMonth'],
      map['electricityAmountResult'],
      map['waterCharge'],
      map['waterUnitPrice'],
      map['waterAmount'],
      map['waterAmountLastMonth'],
      map['waterAmountResult'],
      map['eleImage'],
      map['waterImage'],
      map['state'],
      map['checkState'],
    );
  }

  @override
  String toString() {
    return 'OrderVO{id: $id, roomId: $roomId, roomNum: $roomNum, createDate: $createDate, createDateYear: $createDateYear, createDateMonth: $createDateMonth, rent: $rent, otherCharge: $otherCharge, electricityCharge: $electricityCharge, electricityUnitPrice: $electricityUnitPrice, electricityAmount: $electricityAmount, electricityAmountLastMonth: $electricityAmountLastMonth, electricityAmountResult: $electricityAmountResult, waterCharge: $waterCharge, waterUnitPrice: $waterUnitPrice, waterAmount: $waterAmount, waterAmountLastMonth: $waterAmountLastMonth, waterAmountResult: $waterAmountResult, eleImage: $eleImage, waterImage: $waterImage, state: $state, checkState: $checkState, electricityAmountLastMonthCalculated: $electricityAmountLastMonthCalculated, waterAmountLastMonthCalculated: $waterAmountLastMonthCalculated, contact: $contact}';
  }
}

class OrderState {
  ///未抄表,等待抄表
  static const int WAITING = 0;

  /// 已抄表
  static const int FINISHED = 1;

  /// 已出单
  static const int BILL_OUT = 2;
}

class OrderCheckState {
  ///0.默认状态:未操作
  static const int DEFAULT = 0;

  /// 1.出单状态:已付款
  static const int BILL_OUT_PAID_OFF = 1;

  /// 2.抄表状态:电表未抄
  static const int CHECKING_LACK_ELE = 2;

  /// 3.抄表状态:水表未抄
  static const int CHECKING_LACK_WATER = 3;
}
